<extend name="Public:bg_theme" />
<block name="content">
    <!-- bootstrap -->
    <script type="text/javascript" src="__PUBLIC__/js/bootstrap/js/bootstrap.js"></script>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/js/bootstrap/css/bootstrap.css">
    <!-- x-editable -->
    <script type="text/javascript" src="__PUBLIC__/js/bootstrap-editable-1.4.5/bootstrap-editable/js/bootstrap-editable.js"></script>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/js/bootstrap-editable-1.4.5/bootstrap-editable/css/bootstrap-editable.css">
    <div class="location">
        <i>当前位置：</i>
        <a href="{:U('index')}">扩展管理</a>-
        <a href="javascript:;">插件列表</a>
    </div>
    <div class="title_form">
        <div class="title_search">
            <form action="{:U('')}" method="post">
                <label for="">名称：</label>
                <input type="text" name="name" class="title_text input_style input_focus" value="{:I('name')}">
                <button class="find_btn" type="submit">搜索</button>
            </form>
        </div>
        <a href="{:U('addHook')}"><button class="find_btn add_btn fl">快速创建</button></a>
    </div>
    <div class="content_table">
        <form action="{:U('delete')}" method="post" id="del_form">
            <table id="del_table" class="data-table">
                <tr>
                    <th>名称</th>
                    <th>标识</th>
                    <th>描述</th>
                    <th>状态</th>
                    <th>作者</th>
                    <th>版本</th>
                    <th>操作</th>
                </tr>
                <volist name="list" id="vo">
                    <tr>
                        <td>
                            {$vo.title}
                        </td>
                        <td>{$vo.name}</td>
                        <td>
                            <a href="javascript:;" class="editable" data-name="description" data-type="text" data-pk="{$vo.id}" data-url="{:U('ajaxUpdate')}">{$vo.description}</a>
                        </td>
                        <td>

                            {$vo.status_text|default="未安装"}
                        </td>
                        <td>{$vo.author}</td>
                        <td>{$vo.version}</td>
                        <td>
                    <empty name="vo.uninstall">
                        <?php
                        $class	= get_addon_class($vo['name']);
                        if(!class_exists($class)){
                        $has_config = 0;
                        }else{
                        $addon = new $class();
                        $has_config = count($addon->getConfig());
                        }
                        ?>
                        <?php if ($has_config): ?>
                        <a href="{:U('config',array('id'=>$vo['id']))}">设置</a>
                        <?php endif ?>
                        <?php if ($vo['status'] >= 0): ?>
                        <eq name="vo.status" value="0">
                        <a class="ajax-get" href="{:U('enable',array('id'=>$vo['id']))}">启用</a>
                        <else />
                        <a class="ajax-get" href="{:U('disable',array('id'=>$vo['id']))}">禁用</a>
                        </eq>
                        <?php endif ?>
                        {// <eq name="vo.author" value="thinkphp">}
                        <a class="ajax-get" href="{:U('uninstall?id='.$vo['id'])}">卸载</a>
                        {// </eq>}
                        <else />
                        <a class="ajax-get" href="{:U('install?addon_name='.$vo['name'])}">安装</a>
                    </empty>
                    </td>
                    </tr>
                </volist>
            </table>

        </form>
        {$_page}
    </div>

    <div class="content_btn">

        <button class="find_btn" id="batch_del">删除</button>

    </div>


<script type="text/javascript">
    $(function() {
        //全选
        $("input[name='checkAll']").click(function() {
            $("input#checkEach").attr("checked", this.checked);
        })
        //初始化editable
        $('.editable').editable({
            emptytext: '空',
            success: function(response, newValue) {
                if (!response.status) {
                    return response.info;
                }
            }
        });

        //批量删除
        <include file= "Public:batch_delete" />
    })
</script>
</block>
<block name="foot_js">
    $(function(){
    //左侧导航子页面高亮选中
    highlight_sidebar('{:U('index')}');
    });
</block>
